﻿using System;
using System.Windows.Data;
using System.Globalization;

namespace OverlakeApp.Converters
{
    /// <summary>
    /// Converts a date from a DateTime to the format 'month day, year'.
    /// </summary>
    public class DateConverter : IValueConverter
    {
        /// <summary>
        /// Convert the date to a string.
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is DateTime)
                return ((DateTime)value).ToString("MMMM dd, yyyy");
            
            return null;
        }

        /// <summary>
        /// Not implemented.
        /// </summary>
        /// <param name="value">Not implemented.</param>
        /// <param name="targetType">Not implemented.</param>
        /// <param name="parameter">Not implemented.</param>
        /// <param name="culture">Not implemented.</param>
        /// <returns>Not implemented.</returns>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
